#include "insertdialog.h"
#include "ui_insertdialog.h"

#include <QDebug>

InsertDialog::InsertDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InsertDialog)
{
    ui->setupUi(this);
//    this->setWindowTitle("计工");
}

InsertDialog::InsertDialog(QString *value, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InsertDialog)
{
    ui->setupUi(this);
//    this->setWindowTitle("计工");
    m_value = value;
}

InsertDialog::~InsertDialog()
{
    delete ui;
}

void InsertDialog::on_btnOk_clicked()
{
    QString date = ui->calendarWidget->selectedDate().toString("yyyy-MM-dd");
    double count = ui->spinBoxCount->value();
    QString remarks = ui->lineEditRemarks->text();
    //传出数据
    *m_value = QString("'%1', %2, '%3'").arg(date).arg(count).arg(remarks);
    //关闭窗口
    this->close();

//    qDebug() << "date = " << date;
//    qDebug() << "count = " << count;
//    qDebug() << "remarks = " << remarks;
//    emit insertValue(QString("'%1', %2, '%3'").arg(date).arg(count).arg(remarks));
}
